package com.ywl.designpattern.composite;

/**
 * 2. 创建叶子节点类
 * @author yuwl
 * @description 接下来,我们创建表示文件的叶子节点类:
 * @since 2024-07-03 10:40
 */
public class File implements FileSystemComponent {
    private String name;

    public File(String name) {
        this.name = name;
    }
    @Override
    public void display() {
        System.out.println("File: " + name);
    }

    @Override
    public void add(FileSystemComponent component) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void remove(FileSystemComponent component) {
        throw new UnsupportedOperationException();
    }

    @Override
    public FileSystemComponent getChild(int i) {
        throw new UnsupportedOperationException();
    }
}
